package com.foreveross.proxyip.application.impl.pools;

import java.util.List;
import java.util.Vector;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.foreveross.proxyip.application.pool.PublicPoolApplication;
import com.foreveross.proxyip.core.pools.AvailablePool;
import com.foreveross.proxyip.core.pools.PoolsManager;
import com.foreveross.proxyip.entity.ProxyIpBean;
import com.foreveross.proxyip.infra.PageData;
import com.foreveross.proxyip.util.PoolPageUtil;
@Service
public class PublicPoolApplicationImpl implements PublicPoolApplication {

	@Autowired
	PoolsManager poolsManager;
	/**
	 *  分页获取页面数据
	 * @param pageData
	 * @return
	 * @throws Exception 
	 */
	public PageData loadPageData(PageData pageData) throws Exception{
//		List <ProxyIpBean> ips = new Vector<ProxyIpBean>();
		AvailablePool pool = poolsManager.getPublicPool();
//		ips.addAll( pool.listAllIps());
		PoolPageUtil pagUtil = new PoolPageUtil();
		return pagUtil.loadPageData(pool, pageData);
	}
	
}
